import { S } from '../../s';
import { IPSApplication } from '../../app/ipsapplication';
import { IPSAppDynaDashboardUtil } from '../../app/util/ipsapp-dyna-dashboard-util';
import { PSAjaxControlContainerImpl } from '../psajax-control-container-impl';
import { IPSDBPortletPart } from './ipsdbportlet-part';
import { IPSDashboard } from './ipsdashboard';
import { IPSLayout } from '../layout/ipslayout';

export class PSDashboardImpl
  extends PSAjaxControlContainerImpl
  implements IPSDashboard
{
  get codeName(): string {
    return this.M.codeName;
  }

  protected psappdynadashboardutil: IPSAppDynaDashboardUtil;
  getPSAppDynaDashboardUtil(): IPSAppDynaDashboardUtil | null {
    if (this.psappdynadashboardutil != null) return this.psappdynadashboardutil;
    const value = this.M.getPSAppDynaDashboardUtil;
    if (value == null) {
      return;
    }
    const ipsapplication = this.getParentPSModelObject(
      S._26e,
    ) as IPSApplication;
    if (ipsapplication != null) {
      this.psappdynadashboardutil = ipsapplication.findPSAppUtil(
        value,
      ) as IPSAppDynaDashboardUtil;
    }
    return this.psappdynadashboardutil;
  }

  protected pslayout: IPSLayout;
  getPSLayout(): IPSLayout | null {
    return (
      this.pslayout ||
      (this.pslayout = this.fillObjectModel(
        S._298,
        this.M.getPSLayout,
        S._2e8,
      ) as IPSLayout)
    );
  }

  get enableCustomized(): boolean {
    return this.M.enableCustomized;
  }
  get cls(): string {
    return 'PSDashboardImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._230 || cls == S._227 || cls == S._ae) return true;
    return super.instanceof(cls);
  }
}
